#ifndef _PID_H_
#define _PID_H_
#define NUM_OF_PID (3)
#define PID_PARAM_PAGE (64)
#define TURN_PID_INDEX (0)
typedef struct my_pid{
  float lasterror,lastlasterror,error;
  float now_data,go_data;
  float result,maxresult;
  float kp,ki,kd,kc;
  float ferror,maxferror;
}my_pid;

float pid_result(struct my_pid *pid);
void pid_init(struct my_pid *pid,float go_data,float now_data,float maxresult,float maxferror,float kc,float kp,float ki,float kd);
void read_pid_param(int index_of_pid,float param[]);
void pid_param_storage(int index_of_pid,float kp,float ki,float kd);
void read_all_pid_param(float pid_param[][3]);
void storage_all_pid_param(float pid_param[][3]);
float pid_add_result(struct my_pid *pid);

#endif